package cn.bingoogolapple.qrcode.zxingdemo;

import android.app.Activity;
import android.os.Bundle;

import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.mapapi.SDKInitializer;

/**
 * Created by Administrator on 2016/10/17 0017.
 */
public class test02 extends Activity{

    private LocationClient mLocationClient = null;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        SDKInitializer.initialize(getApplicationContext());
        mLocationClient = Utils.getInstance().getLocationClient(
                test02.this, mBdLocationListener);

        mLocationClient.start();
    }



    // 定位，如果当前定位的城市
    private BDLocationListener mBdLocationListener = new BDLocationListener() {
        @Override
        public void onReceiveLocation(BDLocation location) {
            if (location != null) {
                final String locationCity = location.getCity();
                final String templeCityCode = location.getCityCode();
                System.out.println("郑朝军"+locationCity);
                System.out.println("郑朝军"+templeCityCode);

            }
        }
    };

    @Override
    protected void onStop() {
        mLocationClient.stop();
        super.onStop();
    }


}
